<!--
 * @Description  : 
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2022-04-29 17:28:23
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-05-11 14:25:14
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\partner\\recorded\\components\\record\\record.component.html
 * Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<page-header-wrapper [title]="''"></page-header-wrapper>
<nz-card class="search-box" nzBordered>
  <div nz-row nzGutter="8">
    <div nz-col [nzXl]="_$expand ? 24 : 18" [nzLg]="24" [nzSm]="24" [nzXs]="24">
      <sf
        #sf
        [schema]="searchSchema"
        [ui]="{ '*': { spanLabelFixed: 90, grid: { lg: 8, md: 12, sm: 12, xs: 24, gutter: 15 } } }"
        [compact]="true"
        [button]="'none'"
      ></sf>
    </div>
    <div nz-col [nzXl]="_$expand ? 24 : 6" [nzLg]="24" [nzSm]="24" [nzXs]="24" [class.expend-options]="_$expand" class="text-right">
      <button nz-button nzType="primary" (click)="search()">查询</button>
      <button nz-button (click)="resetSF()">重置</button>
      <button nz-button acl [acl-ability]="['RECORDED-LIST-export']"> 导出</button>
      <button nz-button nzType="link" (click)="expandToggle()">
        {{ !_$expand ? '展开' : '收起' }}
        <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
      </button>
    </div>
  </div>
</nz-card>

<nz-card class="content-box" nzBordered>
  <nz-tabset [nzTabBarExtraContent]="extraTemplate">
    <nz-tab nzTitle="全部" (nzClick)="changeRefundStatus('0')"></nz-tab>
    <nz-tab nzTitle="待初审" (nzClick)="changeRefundStatus('1')"></nz-tab>
    <nz-tab nzTitle="待复核" (nzClick)="changeRefundStatus('2')"></nz-tab>
    <nz-tab nzTitle="已入账" (nzClick)="changeRefundStatus('3')"></nz-tab>
    <nz-tab nzTitle="已拒绝" (nzClick)="changeRefundStatus('4')"></nz-tab>
  </nz-tabset>

  <ng-template #extraTemplate>
    <div class="d-flex align-items-center">
      <div class="mr-md">
        已选择
        <strong class="text-red">{{ selectedRows.length }}</strong> 条数据，累计入账 <strong class="text-red">{{ totalCallNo }}</strong>
        <!-- <a *ngIf="totalCallNo > 0" (click)="st.clearCheck()" class="ml-lg">清空</a> -->
      </div>
      <button nz-button (click)="this.auditAction(null)" acl [acl-ability]="['RECORDED-LIST-audit']">审核</button>
    </div>
  </ng-template>

  <div class="table-content">
    <st
      #st
      [data]="service.$api_get_recorded_page"
      [columns]="columns"
      [req]="{ method: 'POST', allInBody: true, process: beforeReq }"
      [loading]="service.http.loading"
      [scroll]="{ x: '1200px' }"
      (change)="stChange($event)"
      [res]="{ reName: { list: 'data.records', total: 'data.total' }, process: afterRes }"
      [page]="{ show: true, pageSizes: [10, 20, 50, 100, 200, 500] }"
    >
      <ng-template st-row="bankCardNumber" let-item let-index="index" let-column="column">
        {{ item.bankName }} <br />
        {{ item.bankCardNumber }}
      </ng-template>
      <ng-template st-row="sts" let-item let-index="index" let-column="column">
        <div *ngIf="item.sts == '0'">待初审</div>
        <div *ngIf="item.sts == '1'">待复核</div>
        <div *ngIf="item.sts == '2'">已入账</div>
        <div *ngIf="item.sts == '3'">已拒绝</div>
      </ng-template>
    </st>
    <div class="text-md" *ngIf="st?.list?.length !== 0">
      <span class="mr-md"
        >合伙人数：<label class="text-red-dark font-weight-bold">{{ totalInfo?.partnerNum }}</label></span
      >
      <span class="mr-md"
        >入账笔数：<label class="text-red-dark font-weight-bold">{{ totalInfo?.invoiceEntryNum }}</label></span
      >
      <span class="mr-md"
        >开票金额：<label class="text-red-dark font-weight-bold">{{ totalInfo?.invoiceAmountSum }}</label></span
      >
      <span class="mr-md"
        >代缴个税：<label class="text-red-dark font-weight-bold">{{ totalInfo?.taxPersonalSum }}</label></span
      >
      <span class="mr-md"
        >入账金额：<label class="text-red-dark font-weight-bold">{{ totalInfo?.recordedAmountSum }}</label></span
      >
    </div>
  </div>
</nz-card>

<ng-template #auditModal>
  <div nz-row nzGutter="8">
    <div nz-col nzSpan="24" se-container [labelWidth]="80">
      <se [col]="1" label="备注">
        <textarea
          nz-input
          rows="3"
          [(ngModel)]="msg"
          placeholder="同意可以不用填写原因 ，拒绝必须说明原因"
          style="width: 325px; margin-left: 14px"
        ></textarea>
      </se>
    </div>
  </div>
</ng-template>
